package com.xiaoluo.lottery.web;

import com.xiaoluo.lottery.entity.PlayRecord;
import com.xiaoluo.lottery.filter.PlayRecordFilter;
import com.xiaoluo.lottery.service.PlayerService;
import com.xiaoluo.lottery.vo.DataPage;
import com.xiaoluo.lottery.vo.PlayRecordVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by Caedmon on 2016/4/6.
 */
@Controller
@RequestMapping("/player")
public class PlayerController extends BaseController{
    @Autowired
    private PlayerService playerService;
    @RequestMapping("/records")
    public @ResponseBody String records(PlayRecordFilter filter) throws Exception{
        DataPage<PlayRecordVo> page=playerService.getPlayerRecords(filter);
        return new ApiResult(page).toString();
    }
    @RequestMapping("/onlineNum")
    public @ResponseBody String onlineNum() throws Exception{
        int num=playerService.getOnlineNum();
        return new ApiResult(num).toString();
    }
}
